﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcIoc.Service;

namespace MvcIoc.Controllers
{
    public class ProteinTrackerController : Controller
    {

        private readonly IProteinTrackerService proteinTrackerService = null;

        public ProteinTrackerController(IProteinTrackerService proteinTrackerService)
        {
            this.proteinTrackerService = proteinTrackerService;
        }

        // GET: /ProteinTracker/

        public ActionResult Index()
        {
            ViewBag.Goal = proteinTrackerService.Goal;
            ViewBag.Total = proteinTrackerService.Total;

            return View();
        }

        public ActionResult AddProtein(double amount)
        {
            proteinTrackerService.AddProtein(amount);

            ViewBag.Goal = proteinTrackerService.Goal;
            ViewBag.Total = proteinTrackerService.Total;
            return View("Index");
        }

        //
        // GET: /ProteinTracker/Details/5

        //public ActionResult Details(int id)
        //{
        //    return View();
        //}

        ////
        //// GET: /ProteinTracker/Create

        //public ActionResult Create()
        //{
        //    return View();
        //}

        ////
        //// POST: /ProteinTracker/Create

        //[HttpPost]
        //public ActionResult Create(FormCollection collection)
        //{
        //    try
        //    {
        //        // TODO: Add insert logic here

        //        return RedirectToAction("Index");
        //    }
        //    catch
        //    {
        //        return View();
        //    }
        //}

        ////
        //// GET: /ProteinTracker/Edit/5

        //public ActionResult Edit(int id)
        //{
        //    return View();
        //}

        ////
        //// POST: /ProteinTracker/Edit/5

        //[HttpPost]
        //public ActionResult Edit(int id, FormCollection collection)
        //{
        //    try
        //    {
        //        // TODO: Add update logic here

        //        return RedirectToAction("Index");
        //    }
        //    catch
        //    {
        //        return View();
        //    }
        //}

        ////
        //// GET: /ProteinTracker/Delete/5

        //public ActionResult Delete(int id)
        //{
        //    return View();
        //}

        ////
        //// POST: /ProteinTracker/Delete/5

        //[HttpPost]
        //public ActionResult Delete(int id, FormCollection collection)
        //{
        //    try
        //    {
        //        // TODO: Add delete logic here

        //        return RedirectToAction("Index");
        //    }
        //    catch
        //    {
        //        return View();
        //    }
        //}
    }
}
